package leetcode.code1456;

public class Solution extends S1456 {

	@Override
	public int maxVowels(String s, int k) {
		int len = s.length();
		char[] cc = s.toCharArray();
		int l = 0, r = 0, count = 0;
		while (r < k) {
			if (this.isAEIOU(cc[r])) {
				count += 1;
			}
			r++;
		}
		int max = count;
		while (r < len) {
			if (this.isAEIOU(cc[l++])) {
				count -= 1;
			}
			if (this.isAEIOU(cc[r++])) {
				count += 1;
				max = Math.max(max, count);
			}
		}
		return max;
	}

	private boolean isAEIOU(char c) {
		if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
			return true;
		}
		return false;
	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();
		so.debug5();
	}

}
